# Contributor: TBK <alpine@jjtc.eu>
# Maintainer: TBK <alpine@jjtc.eu>
pkgname=nebula
pkgver=1.2.0
pkgrel=2
pkgdesc="A scalable overlay networking tool with a focus on performance, simplicity & security"
url="https://github.com/slackhq/nebula"
arch="all !armv7 !armhf" # https://github.com/slackhq/nebula/issues/212
license="MIT"
pkgusers="$pkgname"
pkggroups="$pkgname"
install="$pkgname.pre-install"
makedepends="go libcap"
subpackages="$pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://github.com/slackhq/nebula/archive/v$pkgver.tar.gz
	$pkgname.initd
	"

build() {
	make BUILD_NUMBER="$pkgver" bin
}

check() {
	make test
}

package() {
	install -Dm750 -o nebula -g nebula nebula -t "$pkgdir"/usr/sbin/
	setcap cap_net_admin+ep "$pkgdir"/usr/sbin/nebula

	install -Dm755 nebula-cert -t "$pkgdir"/usr/bin/

	install -Dm755 examples/config.yml -t "$pkgdir"/etc/$pkgname

	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
}

sha512sums="1dcb8ec532e1345012e2c2367da751eef0d364d222019b4139013086351381fdc23743ac0df34caeb805082d0d2e971c78126465c765f07605f224cbee2a408d  nebula-1.2.0.tar.gz
7c2887da481776d1ed9945f645e81d8843c8abba935c51d3ccf0090d6a2ea0514cf2690fb3db44faca81822bdf5d5306417b227e49cfe035ff0f679425702f12  nebula.initd"
